/*
Navicat SQL Server Data Transfer

Source Server         : sqlserver
Source Server Version : 100000
Source Host           : :1433
Source Database       : statpro
Source Schema         : dbo

Target Server Type    : SQL Server
Target Server Version : 100000
File Encoding         : 65001

Date: 2015-01-08 16:25:41
*/


-- ----------------------------
-- Table structure for jawaban_responden
-- ----------------------------
DROP TABLE [jawaban_responden]
GO
CREATE TABLE [jawaban_responden] (
[id_jawaban_responden] int NOT NULL IDENTITY(1,1) ,
[jawaban] varchar(255) NULL 
)


GO
DBCC CHECKIDENT(N'[jawaban_responden]', RESEED, 2005)
GO

-- ----------------------------
-- Records of jawaban_responden
-- ----------------------------
BEGIN TRANSACTION
GO
SET IDENTITY_INSERT [jawaban_responden] ON
GO
INSERT INTO [jawaban_responden] ([id_jawaban_responden], [jawaban]) VALUES (N'1658', N'Alex'), (N'1659', N'SMA'), (N'1660', N'4'), (N'1661', N'4'), (N'1662', N'4'), (N'1663', N'4'), (N'1664', N'4'), (N'1665', N'4'), (N'1666', N'asd'), (N'1667', N'SMA'), (N'1668', N'4'), (N'1669', N'4'), (N'1670', N'3'), (N'1671', N'4'), (N'1672', N'4'), (N'1673', N'4'), (N'1674', N'qwe'), (N'1675', N'SMP'), (N'1676', N'5'), (N'1677', N'2'), (N'1678', N'2'), (N'1679', N'4'), (N'1680', N'4'), (N'1681', N'5'), (N'1682', N''), (N'1683', null), (N'1684', null), (N'1685', null), (N'1686', null), (N'1687', null), (N'1688', null), (N'1689', null), (N'1690', N's'), (N'1691', N'SD'), (N'1692', N'4'), (N'1693', N'3'), (N'1694', N'4'), (N'1695', N'4'), (N'1696', N'4'), (N'1697', N'4'), (N'1698', N'responden1'), (N'1699', N'SMP'), (N'1700', N'4'), (N'1701', N'4'), (N'1702', N'4'), (N'1703', N'4'), (N'1704', N'4'), (N'1705', N'3'), (N'1706', N''), (N'1707', N'SMP'), (N'1708', N'5'), (N'1709', N'5'), (N'1710', N'5'), (N'1711', N'5'), (N'1712', N'5'), (N'1713', N'5'), (N'1714', N''), (N'1715', N'SMA'), (N'1716', N'5'), (N'1717', N'2'), (N'1718', N'3'), (N'1719', N'4'), (N'1720', N'4'), (N'1721', N'4'), (N'1722', N''), (N'1723', N'SMA'), (N'1724', N'2'), (N'1725', N'2'), (N'1726', N'3'), (N'1727', N'4'), (N'1728', N'2'), (N'1729', N'4'), (N'1754', N''), (N'1755', N'5'), (N'1756', N'3'), (N'1757', N'4'), (N'1758', N'5'), (N'1759', N'5'), (N'1760', N'5'), (N'1761', null), (N'1762', N''), (N'1763', N'4'), (N'1764', N'2'), (N'1765', N'5'), (N'1766', N'5'), (N'1767', N'5'), (N'1768', N'5'), (N'1769', null), (N'1770', N''), (N'1771', N'4'), (N'1772', N'3'), (N'1773', N'4'), (N'1774', N'4'), (N'1775', N'4'), (N'1776', N'4'), (N'1777', null), (N'1778', N''), (N'1779', N'5'), (N'1780', N'3'), (N'1781', N'4')
GO
GO
INSERT INTO [jawaban_responden] ([id_jawaban_responden], [jawaban]) VALUES (N'1782', N'3'), (N'1783', N'2'), (N'1784', N'5'), (N'1785', null), (N'1802', N''), (N'1803', N'4'), (N'1804', N'3'), (N'1805', N'4'), (N'1806', N'4'), (N'1807', N'4'), (N'1808', N'4'), (N'1809', null), (N'1826', N'4'), (N'1827', N'4'), (N'1828', N'4'), (N'1829', N'4'), (N'1830', N'4'), (N'1831', N'4'), (N'1832', N'4'), (N'1833', N'4'), (N'1834', N'3'), (N'1835', N'4'), (N'1836', N'4'), (N'1837', N'4'), (N'1838', N'5'), (N'1839', N'2'), (N'1840', N'2'), (N'1841', N'4'), (N'1842', N'4'), (N'1843', N'5'), (N'1844', N'4'), (N'1845', N'3'), (N'1846', N'4'), (N'1847', N'4'), (N'1848', N'4'), (N'1849', N'4'), (N'1850', N'4'), (N'1851', N'4'), (N'1852', N'4'), (N'1853', N'4'), (N'1854', N'4'), (N'1855', N'3'), (N'1856', N'5'), (N'1857', N'5'), (N'1858', N'5'), (N'1859', N'5'), (N'1860', N'5'), (N'1861', N'5'), (N'1862', N'5'), (N'1863', N'2'), (N'1864', N'3'), (N'1865', N'4'), (N'1866', N'4'), (N'1867', N'4'), (N'1868', N'2'), (N'1869', N'2'), (N'1870', N'3'), (N'1871', N'4'), (N'1872', N'2'), (N'1873', N'4'), (N'1874', N'4'), (N'1875', N'4'), (N'1876', N'4'), (N'1877', N'4'), (N'1878', N'3'), (N'1879', N'3'), (N'1880', N'5'), (N'1881', N'4'), (N'1882', N'3'), (N'1883', N'4'), (N'1884', N'4'), (N'1885', N'3'), (N'1886', N'4'), (N'1887', N'4'), (N'1888', N'4'), (N'1889', N'4'), (N'1890', N'4'), (N'1891', N'4'), (N'1892', N'5'), (N'1893', N'3'), (N'1894', N'4'), (N'1895', N'5'), (N'1896', N'5'), (N'1897', N'5'), (N'1898', N'4'), (N'1899', N'2'), (N'1900', N'5'), (N'1901', N'5'), (N'1902', N'5'), (N'1903', N'5'), (N'1904', N'4'), (N'1905', N'3'), (N'1906', N'4'), (N'1907', N'4'), (N'1908', N'4'), (N'1909', N'4'), (N'1910', N'5'), (N'1911', N'3'), (N'1912', N'4'), (N'1913', N'3')
GO
GO
INSERT INTO [jawaban_responden] ([id_jawaban_responden], [jawaban]) VALUES (N'1914', N'2'), (N'1915', N'5'), (N'1916', N'4'), (N'1917', N'4'), (N'1918', N'4'), (N'1919', N'4'), (N'1920', N'4'), (N'1921', N'4'), (N'1922', N'4'), (N'1923', N'4'), (N'1924', N'3'), (N'1925', N'4'), (N'1926', N'4'), (N'1927', N'4'), (N'1928', N'5'), (N'1929', N'2'), (N'1930', N'2'), (N'1931', N'4'), (N'1932', N'4'), (N'1933', N'5'), (N'1934', N'4'), (N'1935', N'3'), (N'1936', N'4'), (N'1937', N'4'), (N'1938', N'4'), (N'1939', N'4'), (N'1940', N'4'), (N'1941', N'4'), (N'1942', N'4'), (N'1943', N'4'), (N'1944', N'4'), (N'1945', N'3'), (N'1946', N'5'), (N'1947', N'5'), (N'1948', N'5'), (N'1949', N'5'), (N'1950', N'5'), (N'1951', N'5'), (N'1952', N'5'), (N'1953', N'2'), (N'1954', N'3'), (N'1955', N'4'), (N'1956', N'4'), (N'1957', N'4'), (N'1958', N'2'), (N'1959', N'2'), (N'1960', N'3'), (N'1961', N'4'), (N'1962', N'2'), (N'1963', N'4'), (N'1964', N'4'), (N'1965', N'4'), (N'1966', N'4'), (N'1967', N'4'), (N'1968', N'3'), (N'1969', N'3'), (N'1970', N'5'), (N'1971', N'4'), (N'1972', N'3'), (N'1973', N'4'), (N'1974', N'4'), (N'1975', N'3'), (N'1976', N'4'), (N'1977', N'4'), (N'1978', N'4'), (N'1979', N'4'), (N'1980', N'4'), (N'1981', N'4'), (N'1982', N'5'), (N'1983', N'3'), (N'1984', N'4'), (N'1985', N'5'), (N'1986', N'5'), (N'1987', N'5'), (N'1988', N'4'), (N'1989', N'2'), (N'1990', N'5'), (N'1991', N'5'), (N'1992', N'5'), (N'1993', N'5'), (N'1994', N'4'), (N'1995', N'3'), (N'1996', N'4'), (N'1997', N'4'), (N'1998', N'4'), (N'1999', N'4'), (N'2000', N'5'), (N'2001', N'3'), (N'2002', N'4'), (N'2003', N'3'), (N'2004', N'2'), (N'2005', N'5')
GO
GO
SET IDENTITY_INSERT [jawaban_responden] OFF
GO
COMMIT TRANSACTION
GO

-- ----------------------------
-- Table structure for jenis_pertanyaan
-- ----------------------------
DROP TABLE [jenis_pertanyaan]
GO
CREATE TABLE [jenis_pertanyaan] (
[id_jenis_pertanyaan] int NOT NULL ,
[jenis_pertanyaan] varchar(255) NULL 
)


GO

-- ----------------------------
-- Records of jenis_pertanyaan
-- ----------------------------
BEGIN TRANSACTION
GO
INSERT INTO [jenis_pertanyaan] ([id_jenis_pertanyaan], [jenis_pertanyaan]) VALUES (N'0', N'identitas'), (N'1', N'teks'), (N'2', N'pilihan ganda'), (N'3', N'skala')
GO
GO
COMMIT TRANSACTION
GO

-- ----------------------------
-- Table structure for kuesioner
-- ----------------------------
DROP TABLE [kuesioner]
GO
CREATE TABLE [kuesioner] (
[id_kuesioner] int NOT NULL IDENTITY(1,1) ,
[nama_kuesioner] varchar(255) NULL ,
[fk_id_user] int NULL ,
[deskripsi] varchar(255) NULL ,
[file_proposal] varchar(255) NULL ,
[reliabilitas] int NULL DEFAULT ((0)) ,
[validitas] int NULL DEFAULT ((0)) ,
[link] varchar(255) NULL ,
[status] int NULL DEFAULT ((0)) ,
[file_csv] varchar(255) NULL DEFAULT NULL ,
[publish] int NULL DEFAULT ((0)) ,
[publish_metodologi] int NULL DEFAULT ((0)) ,
[publish_data] int NULL DEFAULT ((0)) 
)


GO
DBCC CHECKIDENT(N'[kuesioner]', RESEED, 97)
GO

-- ----------------------------
-- Records of kuesioner
-- ----------------------------
BEGIN TRANSACTION
GO
SET IDENTITY_INSERT [kuesioner] ON
GO
INSERT INTO [kuesioner] ([id_kuesioner], [nama_kuesioner], [fk_id_user], [deskripsi], [file_proposal], [reliabilitas], [validitas], [link], [status], [file_csv], [publish], [publish_metodologi], [publish_data]) VALUES (N'94', N'upload CSV', N'4', N'nyoba', null, N'1', N'1', null, N'1', N'23a8f83d1f1fba1f5371216488a3645f.csv', N'1', N'0', N'0'), (N'96', N'nyoba keterangan', N'4', N'nyoba', N'1f5ee3167c8ae697e1b4e8ce3e59955f.pdf', N'0', N'0', N'81413284b6d482d5823502ff5038ea1c', N'0', null, N'1', N'1', N'0'), (N'97', N'aplot publish', N'4', N'aplot publish', null, N'0', N'0', null, N'1', N'73e7c090e386b81df23221caf692ffda.csv', N'1', N'1', N'0')
GO
GO
SET IDENTITY_INSERT [kuesioner] OFF
GO
COMMIT TRANSACTION
GO

-- ----------------------------
-- Table structure for pertanyaan
-- ----------------------------
DROP TABLE [pertanyaan]
GO
CREATE TABLE [pertanyaan] (
[id_pertanyaan] int NOT NULL IDENTITY(1,1) ,
[pertanyaan] varchar(255) NULL ,
[fk_id_kuesioner] int NULL ,
[fk_id_jenis_pertanyaan] int NULL ,
[fk_id_skala] int NULL ,
[fk_id_pilihan] int NULL 
)


GO
DBCC CHECKIDENT(N'[pertanyaan]', RESEED, 241)
GO

-- ----------------------------
-- Records of pertanyaan
-- ----------------------------
BEGIN TRANSACTION
GO
SET IDENTITY_INSERT [pertanyaan] ON
GO
INSERT INTO [pertanyaan] ([id_pertanyaan], [pertanyaan], [fk_id_kuesioner], [fk_id_jenis_pertanyaan], [fk_id_skala], [fk_id_pilihan]) VALUES (N'229', N'var1', N'94', N'3', null, null), (N'230', N'var2', N'94', N'3', null, null), (N'231', N'var3', N'94', N'3', null, null), (N'232', N'var4', N'94', N'3', null, null), (N'233', N'var5', N'94', N'3', null, null), (N'234', N'var6', N'94', N'3', null, null), (N'235', N'nama', N'96', N'1', null, null), (N'236', N'var1', N'97', N'3', null, null), (N'237', N'var2', N'97', N'3', null, null), (N'238', N'var3', N'97', N'3', null, null), (N'239', N'var4', N'97', N'3', null, null), (N'240', N'var5', N'97', N'3', null, null), (N'241', N'var6', N'97', N'3', null, null)
GO
GO
SET IDENTITY_INSERT [pertanyaan] OFF
GO
COMMIT TRANSACTION
GO

-- ----------------------------
-- Table structure for pilihan_ganda
-- ----------------------------
DROP TABLE [pilihan_ganda]
GO
CREATE TABLE [pilihan_ganda] (
[id_pilihan_ganda] int NOT NULL IDENTITY(1,1) ,
[pilihan] varchar(255) NULL 
)


GO
DBCC CHECKIDENT(N'[pilihan_ganda]', RESEED, 12)
GO

-- ----------------------------
-- Records of pilihan_ganda
-- ----------------------------
BEGIN TRANSACTION
GO
SET IDENTITY_INSERT [pilihan_ganda] ON
GO
SET IDENTITY_INSERT [pilihan_ganda] OFF
GO
COMMIT TRANSACTION
GO

-- ----------------------------
-- Table structure for responden
-- ----------------------------
DROP TABLE [responden]
GO
CREATE TABLE [responden] (
[id_responden] int NOT NULL IDENTITY(1,1) ,
[responden] varchar(255) NULL 
)


GO
DBCC CHECKIDENT(N'[responden]', RESEED, 473)
GO

-- ----------------------------
-- Records of responden
-- ----------------------------
BEGIN TRANSACTION
GO
SET IDENTITY_INSERT [responden] ON
GO
INSERT INTO [responden] ([id_responden], [responden]) VALUES (N'421', N'responden1'), (N'422', N'responden1'), (N'425', N'responden1'), (N'430', N'responden1'), (N'431', N'responden1'), (N'442', N'responden'), (N'443', N'responden'), (N'444', N'responden'), (N'445', N'responden'), (N'446', N'responden'), (N'447', N'responden'), (N'448', N'responden'), (N'449', N'responden'), (N'450', N'responden'), (N'451', N'responden'), (N'452', N'responden'), (N'453', N'responden'), (N'454', N'responden'), (N'455', N'responden'), (N'456', N'responden'), (N'457', N'responden'), (N'458', N'responden'), (N'459', N'responden'), (N'460', N'responden'), (N'461', N'responden'), (N'462', N'responden'), (N'463', N'responden'), (N'464', N'responden'), (N'465', N'responden'), (N'466', N'responden'), (N'467', N'responden'), (N'468', N'responden'), (N'469', N'responden'), (N'470', N'responden'), (N'471', N'responden'), (N'472', N'responden'), (N'473', N'responden')
GO
GO
SET IDENTITY_INSERT [responden] OFF
GO
COMMIT TRANSACTION
GO

-- ----------------------------
-- Table structure for responden_kuesioner
-- ----------------------------
DROP TABLE [responden_kuesioner]
GO
CREATE TABLE [responden_kuesioner] (
[id_responden_kuesioner] int NOT NULL IDENTITY(1,1) ,
[fk_id_responden] int NOT NULL ,
[fk_id_pertanyaan] int NOT NULL ,
[fk_id_jawaban_responden] int NOT NULL 
)


GO
DBCC CHECKIDENT(N'[responden_kuesioner]', RESEED, 2003)
GO

-- ----------------------------
-- Records of responden_kuesioner
-- ----------------------------
BEGIN TRANSACTION
GO
SET IDENTITY_INSERT [responden_kuesioner] ON
GO
INSERT INTO [responden_kuesioner] ([id_responden_kuesioner], [fk_id_responden], [fk_id_pertanyaan], [fk_id_jawaban_responden]) VALUES (N'1824', N'443', N'229', N'1826'), (N'1825', N'443', N'230', N'1827'), (N'1826', N'443', N'231', N'1828'), (N'1827', N'443', N'232', N'1829'), (N'1828', N'443', N'233', N'1830'), (N'1829', N'443', N'234', N'1831'), (N'1830', N'444', N'229', N'1832'), (N'1831', N'444', N'230', N'1833'), (N'1832', N'444', N'231', N'1834'), (N'1833', N'444', N'232', N'1835'), (N'1834', N'444', N'233', N'1836'), (N'1835', N'444', N'234', N'1837'), (N'1836', N'445', N'229', N'1838'), (N'1837', N'445', N'230', N'1839'), (N'1838', N'445', N'231', N'1840'), (N'1839', N'445', N'232', N'1841'), (N'1840', N'445', N'233', N'1842'), (N'1841', N'445', N'234', N'1843'), (N'1842', N'446', N'229', N'1844'), (N'1843', N'446', N'230', N'1845'), (N'1844', N'446', N'231', N'1846'), (N'1845', N'446', N'232', N'1847'), (N'1846', N'446', N'233', N'1848'), (N'1847', N'446', N'234', N'1849'), (N'1848', N'447', N'229', N'1850'), (N'1849', N'447', N'230', N'1851'), (N'1850', N'447', N'231', N'1852'), (N'1851', N'447', N'232', N'1853'), (N'1852', N'447', N'233', N'1854'), (N'1853', N'447', N'234', N'1855'), (N'1854', N'448', N'229', N'1856'), (N'1855', N'448', N'230', N'1857'), (N'1856', N'448', N'231', N'1858'), (N'1857', N'448', N'232', N'1859'), (N'1858', N'448', N'233', N'1860'), (N'1859', N'448', N'234', N'1861'), (N'1860', N'449', N'229', N'1862'), (N'1861', N'449', N'230', N'1863'), (N'1862', N'449', N'231', N'1864'), (N'1863', N'449', N'232', N'1865'), (N'1864', N'449', N'233', N'1866'), (N'1865', N'449', N'234', N'1867'), (N'1866', N'450', N'229', N'1868'), (N'1867', N'450', N'230', N'1869'), (N'1868', N'450', N'231', N'1870'), (N'1869', N'450', N'232', N'1871'), (N'1870', N'450', N'233', N'1872'), (N'1871', N'450', N'234', N'1873'), (N'1872', N'451', N'229', N'1874'), (N'1873', N'451', N'230', N'1875'), (N'1874', N'451', N'231', N'1876'), (N'1875', N'451', N'232', N'1877'), (N'1876', N'451', N'233', N'1878'), (N'1877', N'451', N'234', N'1879'), (N'1878', N'452', N'229', N'1880'), (N'1879', N'452', N'230', N'1881'), (N'1880', N'452', N'231', N'1882'), (N'1881', N'452', N'232', N'1883'), (N'1882', N'452', N'233', N'1884'), (N'1883', N'452', N'234', N'1885'), (N'1884', N'453', N'229', N'1886'), (N'1885', N'453', N'230', N'1887'), (N'1886', N'453', N'231', N'1888'), (N'1887', N'453', N'232', N'1889'), (N'1888', N'453', N'233', N'1890'), (N'1889', N'453', N'234', N'1891'), (N'1890', N'454', N'229', N'1892'), (N'1891', N'454', N'230', N'1893'), (N'1892', N'454', N'231', N'1894'), (N'1893', N'454', N'232', N'1895'), (N'1894', N'454', N'233', N'1896'), (N'1895', N'454', N'234', N'1897'), (N'1896', N'455', N'229', N'1898'), (N'1897', N'455', N'230', N'1899'), (N'1898', N'455', N'231', N'1900'), (N'1899', N'455', N'232', N'1901'), (N'1900', N'455', N'233', N'1902'), (N'1901', N'455', N'234', N'1903'), (N'1902', N'456', N'229', N'1904'), (N'1903', N'456', N'230', N'1905'), (N'1904', N'456', N'231', N'1906'), (N'1905', N'456', N'232', N'1907'), (N'1906', N'456', N'233', N'1908'), (N'1907', N'456', N'234', N'1909'), (N'1908', N'457', N'229', N'1910'), (N'1909', N'457', N'230', N'1911'), (N'1910', N'457', N'231', N'1912'), (N'1911', N'457', N'232', N'1913'), (N'1912', N'457', N'233', N'1914'), (N'1913', N'457', N'234', N'1915'), (N'1914', N'459', N'236', N'1916'), (N'1915', N'459', N'237', N'1917'), (N'1916', N'459', N'238', N'1918'), (N'1917', N'459', N'239', N'1919'), (N'1918', N'459', N'240', N'1920'), (N'1919', N'459', N'241', N'1921'), (N'1920', N'460', N'236', N'1922'), (N'1921', N'460', N'237', N'1923'), (N'1922', N'460', N'238', N'1924'), (N'1923', N'460', N'239', N'1925')
GO
GO
INSERT INTO [responden_kuesioner] ([id_responden_kuesioner], [fk_id_responden], [fk_id_pertanyaan], [fk_id_jawaban_responden]) VALUES (N'1924', N'460', N'240', N'1926'), (N'1925', N'460', N'241', N'1927'), (N'1926', N'461', N'236', N'1928'), (N'1927', N'461', N'237', N'1929'), (N'1928', N'461', N'238', N'1930'), (N'1929', N'461', N'239', N'1931'), (N'1930', N'461', N'240', N'1932'), (N'1931', N'461', N'241', N'1933'), (N'1932', N'462', N'236', N'1934'), (N'1933', N'462', N'237', N'1935'), (N'1934', N'462', N'238', N'1936'), (N'1935', N'462', N'239', N'1937'), (N'1936', N'462', N'240', N'1938'), (N'1937', N'462', N'241', N'1939'), (N'1938', N'463', N'236', N'1940'), (N'1939', N'463', N'237', N'1941'), (N'1940', N'463', N'238', N'1942'), (N'1941', N'463', N'239', N'1943'), (N'1942', N'463', N'240', N'1944'), (N'1943', N'463', N'241', N'1945'), (N'1944', N'464', N'236', N'1946'), (N'1945', N'464', N'237', N'1947'), (N'1946', N'464', N'238', N'1948'), (N'1947', N'464', N'239', N'1949'), (N'1948', N'464', N'240', N'1950'), (N'1949', N'464', N'241', N'1951'), (N'1950', N'465', N'236', N'1952'), (N'1951', N'465', N'237', N'1953'), (N'1952', N'465', N'238', N'1954'), (N'1953', N'465', N'239', N'1955'), (N'1954', N'465', N'240', N'1956'), (N'1955', N'465', N'241', N'1957'), (N'1956', N'466', N'236', N'1958'), (N'1957', N'466', N'237', N'1959'), (N'1958', N'466', N'238', N'1960'), (N'1959', N'466', N'239', N'1961'), (N'1960', N'466', N'240', N'1962'), (N'1961', N'466', N'241', N'1963'), (N'1962', N'467', N'236', N'1964'), (N'1963', N'467', N'237', N'1965'), (N'1964', N'467', N'238', N'1966'), (N'1965', N'467', N'239', N'1967'), (N'1966', N'467', N'240', N'1968'), (N'1967', N'467', N'241', N'1969'), (N'1968', N'468', N'236', N'1970'), (N'1969', N'468', N'237', N'1971'), (N'1970', N'468', N'238', N'1972'), (N'1971', N'468', N'239', N'1973'), (N'1972', N'468', N'240', N'1974'), (N'1973', N'468', N'241', N'1975'), (N'1974', N'469', N'236', N'1976'), (N'1975', N'469', N'237', N'1977'), (N'1976', N'469', N'238', N'1978'), (N'1977', N'469', N'239', N'1979'), (N'1978', N'469', N'240', N'1980'), (N'1979', N'469', N'241', N'1981'), (N'1980', N'470', N'236', N'1982'), (N'1981', N'470', N'237', N'1983'), (N'1982', N'470', N'238', N'1984'), (N'1983', N'470', N'239', N'1985'), (N'1984', N'470', N'240', N'1986'), (N'1985', N'470', N'241', N'1987'), (N'1986', N'471', N'236', N'1988'), (N'1987', N'471', N'237', N'1989'), (N'1988', N'471', N'238', N'1990'), (N'1989', N'471', N'239', N'1991'), (N'1990', N'471', N'240', N'1992'), (N'1991', N'471', N'241', N'1993'), (N'1992', N'472', N'236', N'1994'), (N'1993', N'472', N'237', N'1995'), (N'1994', N'472', N'238', N'1996'), (N'1995', N'472', N'239', N'1997'), (N'1996', N'472', N'240', N'1998'), (N'1997', N'472', N'241', N'1999'), (N'1998', N'473', N'236', N'2000'), (N'1999', N'473', N'237', N'2001'), (N'2000', N'473', N'238', N'2002'), (N'2001', N'473', N'239', N'2003'), (N'2002', N'473', N'240', N'2004'), (N'2003', N'473', N'241', N'2005')
GO
GO
SET IDENTITY_INSERT [responden_kuesioner] OFF
GO
COMMIT TRANSACTION
GO

-- ----------------------------
-- Table structure for skala
-- ----------------------------
DROP TABLE [skala]
GO
CREATE TABLE [skala] (
[id_skala] int NOT NULL IDENTITY(1,1) ,
[skala] varchar(255) NULL 
)


GO
DBCC CHECKIDENT(N'[skala]', RESEED, 38)
GO

-- ----------------------------
-- Records of skala
-- ----------------------------
BEGIN TRANSACTION
GO
SET IDENTITY_INSERT [skala] ON
GO
SET IDENTITY_INSERT [skala] OFF
GO
COMMIT TRANSACTION
GO

-- ----------------------------
-- Table structure for sysdiagrams
-- ----------------------------
DROP TABLE [sysdiagrams]
GO
CREATE TABLE [sysdiagrams] (
[name] sysname NOT NULL ,
[principal_id] int NOT NULL ,
[diagram_id] int NOT NULL IDENTITY(1,1) ,
[version] int NULL ,
[definition] varbinary(MAX) NULL 
)


GO

-- ----------------------------
-- Records of sysdiagrams
-- ----------------------------
BEGIN TRANSACTION
GO
SET IDENTITY_INSERT [sysdiagrams] ON
GO
INSERT INTO [sysdiagrams] ([name], [principal_id], [diagram_id], [version], [definition]) VALUES (N'Diagram_0', N'1', N'1', N'1', 0xD0CF11E0A1B11AE1000000000000000000000000000000003E000300FEFF0900060000000000000000000000010000000100000000000000001000000200000001000000FEFFFFFF0000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFFFF16000000FEFFFFFF0400000005000000060000001500000008000000090000000A0000000B0000000C0000000D0000000E0000000F0000001000000011000000120000001300000014000000FEFFFFFF22000000FEFFFFFF18000000190000001A0000001B0000001C0000001D0000001E0000001F0000002000000021000000FEFFFFFF23000000FEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF52006F006F007400200045006E00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500FFFFFFFFFFFFFFFF0200000000000000000000000000000000000000000000000000000000000000E058F47480F2CF0103000000800C0000000000006600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000201FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000008E070000000000006F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040002010100000004000000FFFFFFFF00000000000000000000000000000000000000000000000000000000000000000000000007000000A71A000000000000010043006F006D0070004F0062006A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000201FFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000000001F0000005F000000000000000100000002000000030000000400000005000000060000000700000008000000090000000A0000000B0000000C0000000D0000000E0000000F000000100000001100000012000000130000001400000015000000160000001700000018000000190000001A0000001B0000001C0000001D0000001E000000FEFFFFFF20000000FEFFFFFFFEFFFFFF230000002400000025000000260000002700000028000000290000002A0000002B0000002C0000002D0000002E0000002F00000030000000FEFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000430000A1E100C05000080160000000F00FFFF16000000007D0000117400007E400000BB870000DB68000007FEFFFF20F8FFFFDE805B10F195D011B0A000AA00BDCB5C0000080030000000000200000300000038002B00000009000000D9E6B0E91C81D011AD5100A0C90F5739F43B7F847F61C74385352986E1D552F8A0327DB2D86295428D98273C25A2DA2D00002C0043200000000000000000000053444DD2011FD1118E63006097D2DF4834C9D2777977D811907000065B840D9C00002C0043200000000000000000000051444DD2011FD1118E63006097D2DF4834C9D2777977D811907000065B840D9C16000000980600000096010000003C00A50900000700008001000000B4020000008000001100008053636847726964008025000012FDFFFF6A61776162616E5F726573706F6E64656E00000000003800A50900000700008002000000B202000000800000100000805363684772696400A0410000000000006A656E69735F70657274616E7961616E00003400A50900000700008003000000A40200000080000009000080536368477269640000000000FA3200006B756573696F6E657274616E00003400A50900000700008004000000A6020000008000000A0000805363684772696400D0200000A41F000070657274616E7961616E616E00003400A50900000700008005000000A4020000008000000900008053636847726964006AFFFFFF96000000726573706F6E64656E6E616E00003C00A50900000700008006000000B80200000080000013000080536368477269640006180000E40C0000726573706F6E64656E5F6B756573696F6E65720000003000A509000007000080070000009C02000000800000050000805363684772696400004B0000C62A0000736B616C6169640000007400A5090000070000800800000052000000018000004A000080436F6E74726F6C00BA340000C529000052656C6174696F6E736869702027464B5F70657274616E7961616E5F73616B616C615F736B616C6127206265747765656E2027736B616C612720616E64202770657274616E7961616E277D0000002800B50100000700008009000000310000006700000002800000436F6E74726F6C00B03700005529000000002C00A5090000070000800A0000009A0200000080000004000080536368477269640000000000E21D00007573657200006800A5090000070000800B00000052000000018000003F000080436F6E74726F6C00F50800000E27000052656C6174696F6E736869702027464B5F6B756573696F6E65725F7573657227206265747765656E2027757365722720616E6420276B756573696F6E6572270000002800B5010000070000800C000000310000005500000002800000436F6E74726F6C009DFFFFFF112E000000008400A5090000070000800D000000620000000180000059000080436F6E74726F6C00D73300000007000052656C6174696F6E736869702027464B5F70657274616E7961616E5F6A656E69735F70657274616E7961616E27206265747765656E20276A656E69735F70657274616E7961616E2720616E64202770657274616E7961616E2700000000002800B5010000070000800E000000310000006F00000002800000436F6E74726F6C000E2F00008A15000000007400A5090000070000800F00000062000000018000004B000080436F6E74726F6C00E9130000392C000052656C6174696F6E736869702027464B5F70657274616E7961616E5F6B756573696F6E657227206265747765656E20276B756573696F6E65722720616E64202770657274616E7961616E270000002800B50100000700008010000000310000006100000002800000436F6E74726F6C00A11B00004F31000000008800A5090000070000801100000062000000018000005D000080436F6E74726F6C0053130000C907000052656C6174696F6E736869702027464B5F726573706F6E64656E5F6B756573696F6E65725F726573706F6E64656E27206265747765656E2027726573706F6E64656E2720616E642027726573706F6E64656E5F6B756573696F6E65722704000000002800B50100000700008012000000310000007300000002800000436F6E74726F6C0091080000730B000000008800A5090000070000801300000052000000018000005F000080436F6E74726F6C00CF1F00003718000052656C6174696F6E736869702027464B5F726573706F6E64656E5F6B756573696F6E65725F70657274616E7961616E27206265747765656E202770657274616E7961616E2720616E642027726573706F6E64656E5F6B756573696F6E6572270000002800B50100000700008014000000310000007500000002800000436F6E74726F6C00152200009F1C000000009800A5090000070000801500000052000000018000006D000080436F6E74726F6C007F2400006104000052656C6174696F6E736869702027464B5F726573706F6E64656E5F6B756573696F6E65725F6A61776162616E5F726573706F6E64656E27206265747765656E20276A61776162616E5F726573706F6E64656E2720616E642027726573706F6E64656E5F6B756573696F6E65722700000000002800B50100000700008016000000310000008300000002800000436F6E74726F6C000F0C00005209000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100FEFF030A0000FFFFFFFF00000000000000000000000000000000170000004D6963726F736F66742044445320466F726D20322E300010000000456D626564214334120800000015150000060A00007856341207000000140100006A00610077006100620061006E005F0072006500730070006F006E00640065006E0000006F006E003D0032002E0030002E0033003500300030002E0030002C002000430075006C0074007500720065003D006E00650075007400720061006C002C0020005000750062006C00690063004B006500790054006F006B0065006E003D00620037003700610035006300350036003100390033003400650030003800390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000005000000540000002C0000002C0000002C0000003400000000000000000000009624000077140000000000002D010000070000000C000000070000001C010000BC07000054060000D0020000840300007602000038040000460500002A03000046050000AE06000092040000000000000100000015150000060A000000000000020000000200000002000000020000001C010000AB0900000000000001000000C7110000ED03000000000000000000000000000002000000020000001C010000BC0700000100000000000000C7110000ED03000000000000000000000000000002000000020000001C010000BC0700000000000000000000072C0000DE20000000000000000000000D00000004000000040000001C010000BC07000024090000A005000078563412040000006C00000001000000010000000B000000000000000100000002000000030000000400000005000000060000000700000008000000090000000A00000004000000640062006F000000120000006A00610077006100620061006E005F0072006500730070006F006E00640065006E000000214334120800000015150000B70900007856341207000000140100006A0065006E00690073005F00700065007200740061006E007900610061006E00000000000000000000000000000000000000000090FD595900000000C480585900000000D080585900000000DC80585900000000E880585900000000F48058590000000000815859000000000C815859000000001881585900000000248158590000000030815859000000003C815859000000004881585900000000548158590000000060815859000000006C8158590000000078815859000000008481585990815859908158599C8158599C815859A8815859A8815859B4815859B4815859C0815859C0815859CC815859CC81000000000000000000000100000005000000540000002C0000002C0000002C0000003400000000000000000000009624000077140000000000002D010000070000000C000000070000001C010000BC07000054060000D0020000840300007602000038040000460500002A03000046050000AE06000092040000000000000100000015150000B709000000000000020000000200000002000000020000001C010000AB0900000000000001000000C7110000FF05000000000000010000000100000002000000020000001C010000BC0700000100000000000000C7110000ED03000000000000000000000000000002000000020000001C010000BC0700000000000000000000072C0000DE20000000000000000000000D00000004000000040000001C010000BC07000024090000A005000078563412040000006A00000001000000010000000B000000000000000100000002000000030000000400000005000000060000000700000008000000090000000A00000004000000640062006F000000110000006A0065006E00690073005F00700065007200740061006E007900610061006E000000214334120800000015150000E30B00007856341207000000140100006B0075006500730069006F006E0065007200000061002C002000560065007200730069006F006E003D0032002E0030002E0030002E0030002C002000430075006C0074007500720065003D006E00650075007400720061006C002C0020005000750062006C00690063004B006500790054006F006B0065006E003D00620037003700610035006300350036003100390033003400650030003800390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000005000000540000002C0000002C0000002C0000003400000000000000000000009624000077140000000000002D010000070000000C000000070000001C010000BC07000054060000D0020000840300007602000038040000460500002A03000046050000AE06000092040000000000000100000015150000E30B000000000000030000000300000002000000020000001C010000AB0900000000000001000000C71100001008000000000000020000000200000002000000020000001C010000BC0700000100000000000000C7110000ED03000000000000000000000000000002000000020000001C010000BC0700000000000000000000072C0000DE20000000000000000000000D00000004000000040000001C010000BC07000024090000A005000078563412040000005C00000001000000010000000B000000000000000100000002000000030000000400000005000000060000000700000008000000090000000A00000004000000640062006F0000000A0000006B0075006500730069006F006E00650072000000214334120800000016150000FD0E0000785634120700000014010000700065007200740061006E007900610061006E0000006F006700720061006D002000460069006C00650073002F004D006900630072006F0073006F00660074002000530051004C0020005300650072007600650072002F003100300030002F0054006F006F006C0073002F00420069006E006E002F00560053005300680065006C006C002F0043006F006D006D006F006E0037002F004900440045002F004D006900630072006F0073006F00660074002E00530071006C005300650072007600650072002E004D0061006E006100670065006D0065006E0074002E0044006D0066002E00550049002F004D006900000000000000000000000100000005000000540000002C0000002C0000002C0000003400000000000000000000009624000077140000000000002D010000070000000C000000070000001C010000BC07000054060000D0020000840300007602000038040000460500002A03000046050000AE06000092040000000000000100000016150000FD0E000000000000050000000500000002000000020000001C010000AB0900000000000001000000C71100001008000000000000020000000200000002000000020000001C010000BC0700000100000000000000C7110000ED03000000000000000000000000000002000000020000001C010000BC0700000000000000000000072C0000DE20000000000000000000000D00000004000000040000001C010000BC07000024090000A005000078563412040000005E00000001000000010000000B000000000000000100000002000000030000000400000005000000060000000700000008000000090000000A00000004000000640062006F0000000B000000700065007200740061006E007900610061006E000000214334120800000015150000B709000078563412070000001401000072006500730070006F006E00640065006E00000072006F006700720061006D002000460069006C00650073002F004D006900630072006F0073006F00660074002000530051004C0020005300650072007600650072002F003100300030002F0054006F006F006C0073002F00420069006E006E002F00560053005300680065006C006C002F0043006F006D006D006F006E0037002F004900440045002F005000750062006C006900630041007300730065006D0062006C006900650073002F0065006E002F004D006900630072006F0073006F00660074002E00530071006C005300650072007600650072002E00000000000000000000000100000005000000540000002C0000002C0000002C0000003400000000000000000000009624000077140000000000002D010000070000000C000000070000001C010000BC07000054060000D0020000840300007602000038040000460500002A03000046050000AE06000092040000000000000100000015150000B709000000000000020000000200000002000000020000001C010000AB0900000000000001000000C7110000FF05000000000000010000000100000002000000020000001C010000BC0700000100000000000000C7110000ED03000000000000000000000000000002000000020000001C010000BC0700000000000000000000072C0000DE20000000000000000000000D00000004000000040000001C010000BC07000024090000A005000078563412040000005C00000001000000010000000B000000000000000100000002000000030000000400000005000000060000000700000008000000090000000A00000004000000640062006F0000000A00000072006500730070006F006E00640065006E0000002143341208000000151500000E0E000078563412070000001401000072006500730070006F006E00640065006E005F006B0075006500730069006F006E00650072000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000005000000540000002C0000002C0000002C0000003400000000000000000000009624000077140000000000002D010000070000000C000000070000001C010000BC07000054060000D0020000840300007602000038040000460500002A03000046050000AE060000920400000000000001000000151500000E0E000000000000040000000400000002000000020000001C010000AB0900000000000001000000C7110000FF05000000000000010000000100000002000000020000001C010000BC0700000100000000000000C7110000ED03000000000000000000000000000002000000020000001C010000BC0700000000000000000000072C0000DE20000000000000000000000D00000004000000040000001C010000BC07000024090000A005000078563412040000007000000001000000010000000B000000000000000100000002000000030000000400000005000000060000000700000008000000090000000A00000004000000640062006F0000001400000072006500730070006F006E00640065006E005F006B0075006500730069006F006E00650072000000214334120800000015150000B709000078563412070000001401000073006B0061006C006100000000000000000000000000000000000000440000443DFA0800C400640050FF1E050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000005000000540000002C0000002C0000002C0000003400000000000000000000009624000077140000000000002D010000070000000C000000070000001C010000BC07000054060000D0020000840300007602000038040000460500002A03000046050000AE06000092040000000000000100000015150000B709000000000000020000000200000002000000020000001C010000AB0900000000000001000000C7110000FF05000000000000010000000100000002000000020000001C010000BC0700000100000000000000C7110000ED03000000000000000000000000000002000000020000001C010000BC0700000000000000000000072C0000DE20000000000000000000000D00000004000000040000001C010000BC07000024090000A005000078563412040000005400000001000000010000000B000000000000000100000002000000030000000400000005000000060000000700000008000000090000000A00000004000000640062006F0000000600000073006B0061006C006100000002000B00004B00005C2B0000E63500005C2B00000000000002000000F0F0F00000000000000000000000000000000000010000000900000000000000B037000055290000C50F00005801000042000000010000020000C50F000058010000020000000000050000800800008001000000150001000000900144420100065461686F6D611A0046004B005F00700065007200740061006E007900610061006E005F00730061006B0061006C0061005F0073006B0061006C006100214334120800000015150000E30B000078563412070000001401000075007300650072000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000005000000540000002C0000002C0000002C0000003400000000000000000000009624000077140000000000002D010000070000000C000000070000001C010000BC07000054060000D0020000840300007602000038040000460500002A03000046050000AE06000092040000000000000100000015150000E30B000000000000030000000300000002000000020000001C010000AB0900000000000001000000C7110000FF05000000000000010000000100000002000000020000001C010000BC0700000100000000000000C7110000ED03000000000000000000000000000002000000020000001C010000BC0700000000000000000000072C0000DE20000000000000000000000D00000004000000040000001C010000BC07000024090000A005000078563412040000005200000001000000010000000B000000000000000100000002000000030000000400000005000000060000000700000008000000090000000A00000004000000640062006F000000050000007500730065007200000002000B008C0A0000C52900008C0A0000FA3200000000000002000000F0F0F00000000000000000000000000000000000010000000C000000000000009DFFFFFF112E0000400A00005801000037000000010000020000400A000058010000020000000000050000800800008001000000150001000000900144420100065461686F6D61110046004B005F006B0075006500730069006F006E00650072005F00750073006500720004000B0036420000B7090000364200002C1D0000523500002C1D000052350000A41F00000000000002000000F0F0F00000000000000000000000000000000000010000000E000000000000000E2F00008A1500007912000058010000260000000100000200007912000058010000020000000000050000800800008001000000150001000000900144420100065461686F6D611E0046004B005F00700065007200740061006E007900610061006E005F006A0065006E00690073005F00700065007200740061006E007900610061006E0004000B001515000090330000F21A000090330000F21A0000B42D0000D0200000B42D00000000000002000000F0F0F00000000000000000000000000000000000010000001000000000000000A11B00004F310000320E00005801000032000000010000020000320E000058010000020000000000FFFFFF000800008001000000150001000000900144420100065461686F6D61170046004B005F00700065007200740061006E007900610061006E005F006B0075006500730069006F006E006500720004000B007F140000600900004216000060090000421600007A0D0000061800007A0D00000000000002000000F0F0F0000000000000000000000000000000000001000000120000000000000091080000730B00000D140000580100005E0000000100000200000D14000058010000020000000000FFFFFF000800008001000000150001000000900144420100065461686F6D61200046004B005F0072006500730070006F006E00640065006E005F006B0075006500730069006F006E00650072005F0072006500730070006F006E00640065006E0002000B0066210000A41F000066210000F21A00000000000002000000F0F0F00000000000000000000000000000000000010000001400000000000000152200009F1C00009D14000058010000320000000100000200009D14000058010000020000000000FFFFFF000800008001000000150001000000900144420100065461686F6D61210046004B005F0072006500730070006F006E00640065006E005F006B0075006500730069006F006E00650072005F00700065007200740061006E007900610061006E0002000B00162600001807000016260000E40C00000000000002000000F0F0F000000000000000000000000000000000000100000016000000000000000F0C0000520900005819000058010000320000000100000200005819000058010000020000000000FFFFFF000800008001000000150001000000900144420100065461686F6D61280046004B005F0072006500730070006F006E00640065006E005F006B0075006500730069006F006E00650072005F006A00610077006100620061006E005F0072006500730070006F006E00640065006E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000646564204F626A6563740000000000F439B271000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010003000000000000000C0000000B0000004E61BC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000DBE6B0E91C81D011AD5100A0C90F573900000200E076EF7480F2CF010202000010484500000000000000000000000000000000006E0100004400610074006100200053006F0075007200630065003D006100640064006900650073002D00610062006100620061002D00700063003B0049006E0069007400690061006C00200043006100740061006C006F0067003D007300740061007400700072006F003B0049006E00740065006700720061007400650064002000530065006300750072006900740079003D0054007200750065003B004D0075006C007400690070006C00650041006300740069007600650052006500730075006C00740053006500740073003D00460061006C00730065003B005000610063006B00650074002000530069007A0065003D0034003000390036003B004100700070006C00690063006100740069006F006E0020004E0061006D0065003D0022004D006900630072006F0073006F00660074002000530051004C00200053006500720076006500720020000300440064007300530074007200650061006D000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000160002000300000006000000FFFFFFFF00000000000000000000000000000000000000000000000000000000000000000000000017000000711500000000000053006300680065006D00610020005500440056002000440065006600610075006C0074000000000000000000000000000000000000000000000000000000000026000200FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000210000001600000000000000440053005200450046002D0053004300480045004D0041002D0043004F004E00540045004E0054005300000000000000000000000000000000000000000000002C0002010500000007000000FFFFFFFF000000000000000000000000000000000000000000000000000000000000000000000000220000008C0300000000000053006300680065006D00610020005500440056002000440065006600610075006C007400200050006F007300740020005600360000000000000000000000000036000200FFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000000003100000012000000000000000C00000007FEFFFF20F8FFFF0100260000007300630068005F006C006100620065006C0073005F00760069007300690062006C0065000000010000000B0000001E000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000010000000100000000000000000000000000000000000000D00200000600280000004100630074006900760065005400610062006C00650056006900650077004D006F006400650000000100000008000400000031000000200000005400610062006C00650056006900650077004D006F00640065003A00300000000100000008003A00000034002C0030002C003200380034002C0030002C0031003900380030002C0031002C0031003600320030002C0035002C0031003000380030000000200000005400610062006C00650056006900650077004D006F00640065003A00310000000100000008001E00000032002C0030002C003200380034002C0030002C0032003400370035000000200000005400610062006C00650056006900650077004D006F00640065003A00320000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00330000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00340000000100000008003E00000034002C0030002C003200380034002C0030002C0031003900380030002C00310032002C0032003300340030002C00310031002C0031003400340030000000020000000200000000000000000000000000000000000000D00200000600280000004100630074006900760065005400610062006C00650056006900650077004D006F006400650000000100000008000400000031000000200000005400610062006C00650056006900650077004D006F00640065003A00300000000100000008003A00000034002C0030002C003200380034002C0030002C0031003900380030002C0031002C0031003600320030002C0035002C0031003000380030000000200000005400610062006C00650056006900650077004D006F00640065003A00310000000100000008001E00000032002C0030002C003200380034002C0030002C0032003400370035000000200000005400610062006C00650056006900650077004D006F00640065003A00320000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00330000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00340000000100000008003E00000034002C0030002C003200380034002C0030002C0031003900380030002C00310032002C0032003300340030002C00310031002C0031003400340030000000030000000300000000000000000000000000000000000000D00200000600280000004100630074006900760065005400610062006C00650056006900650077004D006F006400650000000100000008000400000031000000200000005400610062006C00650056006900650077004D006F00640065003A00300000000100000008003A00000034002C0030002C003200380034002C0030002C0031003900380030002C0031002C0031003600320030002C0035002C0031003000380030000000200000005400610062006C00650056006900650077004D006F00640065003A00310000000100000008001E00000032002C0030002C003200380034002C0030002C0032003400370035000000200000005400610062006C00650056006900650077004D006F00640065003A00320000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00330000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00340000000100000008003E00000034002C0030002C003200380034002C0030002C0031003900380030002C00310032002C0032003300340030002C00310031002C0031003400340030000000040000000400000000000000000000000000000000000000D00200000600280000004100630074006900760065005400610062006C00650056006900650077004D006F006400650000000100000008000400000031000000200000005400610062006C00650056006900650077004D006F00640065003A00300000000100000008003A00000034002C0030002C003200380034002C0030002C0031003900380030002C0031002C0031003600320030002C0035002C0031003000380030000000200000005400610062006C00650056006900650077004D006F00640065003A00310000000100000008001E00000032002C0030002C003200380034002C0030002C0032003400370035000000200000005400610062006C00650056006900650077004D006F00640065003A00320000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00330000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00340000000100000008003E00000034002C0030002C003200380034002C0030002C0031003900380030002C00310032002C0032003300340030002C00310031002C0031003400340030000000050000000500000000000000000000000000000000000000D00200000600280000004100630074006900760065005400610062006C00650056006900650077004D006F006400650000000100000008000400000031000000200000005400610062006C00650056006900650077004D006F00640065003A00300000000100000008003A00000034002C0030002C003200380034002C0030002C0031003900380030002C0031002C0031003600320030002C0035002C0031003000380030000000200000005400610062006C00650056006900650077004D006F00640065003A00310000000100000008001E00000032002C0030002C003200380034002C0030002C0032003400370035000000200000005400610062006C00650056006900650077004D006F00640065003A00320000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00330000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00340000000100000008003E00000034002C0030002C003200380034002C0030002C0031003900380030002C00310032002C0032003300340030002C00310031002C0031003400340030000000060000000600000000000000000000000000000000000000D00200000600280000004100630074006900760065005400610062006C00650056006900650077004D006F006400650000000100000008000400000031000000200000005400610062006C00650056006900650077004D006F00640065003A00300000000100000008003A00000034002C0030002C003200380034002C0030002C0031003900380030002C0031002C0031003600320030002C0035002C0031003000380030000000200000005400610062006C00650056006900650077004D006F00640065003A00310000000100000008001E00000032002C0030002C003200380034002C0030002C0032003400370035000000200000005400610062006C00650056006900650077004D006F00640065003A00320000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00330000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00340000000100000008003E00000034002C0030002C003200380034002C0030002C0031003900380030002C00310032002C0032003300340030002C00310031002C0031003400340030000000070000000700000000000000000000000000000000000000D00200000600280000004100630074006900760065005400610062006C00650056006900650077004D006F006400650000000100000008000400000031000000200000005400610062006C00650056006900650077004D006F00640065003A00300000000100000008003A00000034002C0030002C003200380034002C0030002C0031003900380030002C0031002C0031003600320030002C0035002C0031003000380030000000200000005400610062006C00650056006900650077004D006F00640065003A00310000000100000008001E00000032002C0030002C003200380034002C0030002C0032003400370035000000200000005400610062006C00650056006900650077004D006F00640065003A00320000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00330000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00340000000100000008003E00000034002C0030002C003200380034002C0030002C0031003900380030002C00310032002C0032003300340030002C00310031002C00310034003400300000000800000008000000000000004600000001014F0B01000000640062006F00000046004B005F00700065007200740061006E007900610061006E005F00730061006B0061006C0061005F0073006B0061006C00610000000000000000000000C40200000000090000000900000008000000080000000148B4085848B4080000000000000000AD0F00000100000A0000000A00000000000000000000000000000000000000D00200000600280000004100630074006900760065005400610062006C00650056006900650077004D006F006400650000000100000008000400000031000000200000005400610062006C00650056006900650077004D006F00640065003A00300000000100000008003A00000034002C0030002C003200380034002C0030002C0031003900380030002C0031002C0031003600320030002C0035002C0031003000380030000000200000005400610062006C00650056006900650077004D006F00640065003A00310000000100000008001E00000032002C0030002C003200380034002C0030002C0032003400370035000000200000005400610062006C00650056006900650077004D006F00640065003A00320000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00330000000100000008001E00000032002C0030002C003200380034002C0030002C0031003900380030000000200000005400610062006C00650056006900650077004D006F00640065003A00340000000100000008003E00000034002C0030002C003200380034002C0030002C0031003900380030002C00310032002C0032003300340030002C00310031002C00310034003400300000000B0000000B00000000000000340000000101B40801000000640062006F00000046004B005F006B0075006500730069006F006E00650072005F00750073006500720000000000000000000000C402000000000C0000000C0000000B000000080000000148B4089848B4080000000000000000AD0F00000100000D0000000D000000000000004E0000000100800B01000000640062006F00000046004B005F00700065007200740061006E007900610061006E005F006A0065006E00690073005F00700065007200740061006E007900610061006E0000000000000000000000C402000000000E0000000E0000000D000000080000000143B4081843B4080000000000000000AD0F00000100000F0000000F00000000000000400000000100000001000000640062006F00000046004B005F00700065007200740061006E007900610061006E005F006B0075006500730069006F006E006500720000000000000000000000C4020000000010000000100000000F000000080000000149B4085849B4080000000000000000AD0F0000010000110000001100000000000000520000000100000001000000640062006F00000046004B005F0072006500730070006F006E00640065006E005F006B0075006500730069006F006E00650072005F0072006500730070006F006E00640065006E0000000000000000000000C4020000000012000000120000001100000008000000014EB408984EB4080000000000000000AD0F0000010000130000001300000000000000540000000100000001000000640062006F00000046004B005F0072006500730070006F006E00640065006E005F006B0075006500730069006F006E00650072005F00700065007200740061006E007900610061006E0000000000000000000000C4020000000014000000140000001300000008000000014EB408D84EB4080000000000000000AD0F0000010000150000001500000000000000620000000100701601000000640062006F00000046004B005F0072006500730070006F006E00640065006E005F006B0075006500730069006F006E00650072005F006A00610077006100620061006E005F0072006500730070006F006E00640065006E0000000000000000000000C4020000000016000000160000001500000008000000014FB408184FB4080000000000000000AD0F000001000023000000150000000100000006000000010000002E0000000D000000020000000400000001000000440000000F00000003000000040000004700000074000000130000000400000006000000000000001F0000001100000005000000060000006300000046000000080000000700000004000000460000006D0000000B0000000A00000003000000230000002200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004D0061006E006100670065006D0065006E0074002000530074007500640069006F002200000000800500140000004400690061006700720061006D005F003000000000022600240000006A00610077006100620061006E005F0072006500730070006F006E00640065006E00000008000000640062006F00000000022600220000006A0065006E00690073005F00700065007200740061006E007900610061006E00000008000000640062006F00000000022600140000006B0075006500730069006F006E0065007200000008000000640062006F0000000002260016000000700065007200740061006E007900610061006E00000008000000640062006F000000000226001400000072006500730070006F006E00640065006E00000008000000640062006F000000000226002800000072006500730070006F006E00640065006E005F006B0075006500730069006F006E0065007200000008000000640062006F000000000226000C00000073006B0061006C006100000008000000640062006F000000000224000A0000007500730065007200000008000000640062006F00000001000000D68509B3BB6BF2459AB8371664F0327008004E0000007B00310036003300340043004400440037002D0030003800380038002D0034003200450033002D0039004600410032002D004200360044003300320035003600330042003900310044007D00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010003000000000000000C0000000B0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000062885214)
GO
GO
SET IDENTITY_INSERT [sysdiagrams] OFF
GO
COMMIT TRANSACTION
GO

-- ----------------------------
-- Table structure for tabel_t
-- ----------------------------
DROP TABLE [tabel_t]
GO
CREATE TABLE [tabel_t] (
[id_tabel_t] int NOT NULL ,
[0.05] varchar(255) NULL 
)


GO

-- ----------------------------
-- Records of tabel_t
-- ----------------------------
BEGIN TRANSACTION
GO
INSERT INTO [tabel_t] ([id_tabel_t], [0.05]) VALUES (N'1', N'12.71'), (N'2', N'4.303'), (N'3', N'3.182'), (N'4', N'2.776'), (N'5', N'2.571'), (N'6', N'2.447'), (N'7', N'2.365'), (N'8', N'2.306'), (N'9', N'2.262'), (N'10', N'2.228'), (N'11', N'2.201'), (N'12', N'2.179'), (N'13', N'2.160'), (N'14', N'2.145'), (N'15', N'2.131'), (N'16', N'2.120'), (N'17', N'2.110'), (N'18', N'2.101'), (N'19', N'2.093'), (N'20', N'2.086'), (N'21', N'2.080'), (N'22', N'2.074'), (N'23', N'2.069'), (N'24', N'2.064'), (N'25', N'2.060'), (N'26', N'2.056'), (N'27', N'2.052'), (N'28', N'2.048'), (N'29', N'2.045'), (N'30', N'2.042'), (N'40', N'2.021'), (N'60', N'2.000'), (N'80', N'1.990'), (N'100', N'1.984'), (N'1000', N'1.962')
GO
GO
COMMIT TRANSACTION
GO

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE [user]
GO
CREATE TABLE [user] (
[id_user] int NOT NULL IDENTITY(1,1) ,
[nama] varchar(255) NULL ,
[password] varchar(255) NULL ,
[role] int NULL ,
[email] varchar(255) NULL ,
[status] int NULL DEFAULT ((0)) 
)


GO
DBCC CHECKIDENT(N'[user]', RESEED, 10)
GO

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN TRANSACTION
GO
SET IDENTITY_INSERT [user] ON
GO
INSERT INTO [user] ([id_user], [nama], [password], [role], [email], [status]) VALUES (N'3', N'coba', N'c3ec0f7b054e729c5a716c8125839829', N'1', null, N'0'), (N'4', N'adis', N'56af1302e6e440e4dbcfa3cf0af4887f', N'1', N'addies_ababa1@yahoo.com', N'1'), (N'9', N'admin', N'21232f297a57a5a743894a0e4a801fc3', N'0', N'admin@gmail.com', N'1'), (N'10', N'email', N'0c83f57c786a0b4a39efab23731c7ebc', N'1', N'cek@gmail.com', N'0')
GO
GO
SET IDENTITY_INSERT [user] OFF
GO
COMMIT TRANSACTION
GO

-- ----------------------------
-- Procedure structure for sp_alterdiagram
-- ----------------------------
DROP PROCEDURE [sp_alterdiagram]
GO

	CREATE PROCEDURE [sp_alterdiagram]
	(
		@diagramname 	sysname,
		@owner_id	int	= null,
		@version 	int,
		@definition 	varbinary(max)
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
	
		declare @theId 			int
		declare @retval 		int
		declare @IsDbo 			int
		
		declare @UIDFound 		int
		declare @DiagId			int
		declare @ShouldChangeUID	int
	
		if(@diagramname is null)
		begin
			RAISERROR ('Invalid ARG', 16, 1)
			return -1
		end
	
		execute as caller;
		select @theId = DATABASE_PRINCIPAL_ID();	 
		select @IsDbo = IS_MEMBER(N'db_owner'); 
		if(@owner_id is null)
			select @owner_id = @theId;
		revert;
	
		select @ShouldChangeUID = 0
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname 
		
		if(@DiagId IS NULL or (@IsDbo = 0 and @theId <> @UIDFound))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1);
			return -3
		end
	
		if(@IsDbo <> 0)
		begin
			if(@UIDFound is null or USER_NAME(@UIDFound) is null) -- invalid principal_id
			begin
				select @ShouldChangeUID = 1 ;
			end
		end

		-- update dds data			
		update dbo.sysdiagrams set definition = @definition where diagram_id = @DiagId ;

		-- change owner
		if(@ShouldChangeUID = 1)
			update dbo.sysdiagrams set principal_id = @theId where diagram_id = @DiagId ;

		-- update dds version
		if(@version is not null)
			update dbo.sysdiagrams set version = @version where diagram_id = @DiagId ;

		return 0
	END
	
GO

-- ----------------------------
-- Procedure structure for sp_creatediagram
-- ----------------------------
DROP PROCEDURE [sp_creatediagram]
GO

	CREATE PROCEDURE [sp_creatediagram]
	(
		@diagramname 	sysname,
		@owner_id		int	= null, 	
		@version 		int,
		@definition 	varbinary(max)
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
	
		declare @theId int
		declare @retval int
		declare @IsDbo	int
		declare @userName sysname
		if(@version is null or @diagramname is null)
		begin
			RAISERROR (N'E_INVALIDARG', 16, 1);
			return -1
		end
	
		execute as caller;
		select @theId = DATABASE_PRINCIPAL_ID(); 
		select @IsDbo = IS_MEMBER(N'db_owner');
		revert; 
		
		if @owner_id is null
		begin
			select @owner_id = @theId;
		end
		else
		begin
			if @theId <> @owner_id
			begin
				if @IsDbo = 0
				begin
					RAISERROR (N'E_INVALIDARG', 16, 1);
					return -1
				end
				select @theId = @owner_id
			end
		end
		-- next 2 line only for test, will be removed after define name unique
		if EXISTS(select diagram_id from dbo.sysdiagrams where principal_id = @theId and name = @diagramname)
		begin
			RAISERROR ('The name is already used.', 16, 1);
			return -2
		end
	
		insert into dbo.sysdiagrams(name, principal_id , version, definition)
				VALUES(@diagramname, @theId, @version, @definition) ;
		
		select @retval = @@IDENTITY 
		return @retval
	END
	
GO

-- ----------------------------
-- Procedure structure for sp_dropdiagram
-- ----------------------------
DROP PROCEDURE [sp_dropdiagram]
GO

	CREATE PROCEDURE [sp_dropdiagram]
	(
		@diagramname 	sysname,
		@owner_id	int	= null
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
		declare @theId 			int
		declare @IsDbo 			int
		
		declare @UIDFound 		int
		declare @DiagId			int
	
		if(@diagramname is null)
		begin
			RAISERROR ('Invalid value', 16, 1);
			return -1
		end
	
		EXECUTE AS CALLER;
		select @theId = DATABASE_PRINCIPAL_ID();
		select @IsDbo = IS_MEMBER(N'db_owner'); 
		if(@owner_id is null)
			select @owner_id = @theId;
		REVERT; 
		
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname 
		if(@DiagId IS NULL or (@IsDbo = 0 and @UIDFound <> @theId))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1)
			return -3
		end
	
		delete from dbo.sysdiagrams where diagram_id = @DiagId;
	
		return 0;
	END
	
GO

-- ----------------------------
-- Procedure structure for sp_helpdiagramdefinition
-- ----------------------------
DROP PROCEDURE [sp_helpdiagramdefinition]
GO

	CREATE PROCEDURE [sp_helpdiagramdefinition]
	(
		@diagramname 	sysname,
		@owner_id	int	= null 		
	)
	WITH EXECUTE AS N'dbo'
	AS
	BEGIN
		set nocount on

		declare @theId 		int
		declare @IsDbo 		int
		declare @DiagId		int
		declare @UIDFound	int
	
		if(@diagramname is null)
		begin
			RAISERROR (N'E_INVALIDARG', 16, 1);
			return -1
		end
	
		execute as caller;
		select @theId = DATABASE_PRINCIPAL_ID();
		select @IsDbo = IS_MEMBER(N'db_owner');
		if(@owner_id is null)
			select @owner_id = @theId;
		revert; 
	
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname;
		if(@DiagId IS NULL or (@IsDbo = 0 and @UIDFound <> @theId ))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1);
			return -3
		end

		select version, definition FROM dbo.sysdiagrams where diagram_id = @DiagId ; 
		return 0
	END
	
GO

-- ----------------------------
-- Procedure structure for sp_helpdiagrams
-- ----------------------------
DROP PROCEDURE [sp_helpdiagrams]
GO

	CREATE PROCEDURE [sp_helpdiagrams]
	(
		@diagramname sysname = NULL,
		@owner_id int = NULL
	)
	WITH EXECUTE AS N'dbo'
	AS
	BEGIN
		DECLARE @user sysname
		DECLARE @dboLogin bit
		EXECUTE AS CALLER;
			SET @user = USER_NAME();
			SET @dboLogin = CONVERT(bit,IS_MEMBER('db_owner'));
		REVERT;
		SELECT
			[Database] = DB_NAME(),
			[Name] = name,
			[ID] = diagram_id,
			[Owner] = USER_NAME(principal_id),
			[OwnerID] = principal_id
		FROM
			sysdiagrams
		WHERE
			(@dboLogin = 1 OR USER_NAME(principal_id) = @user) AND
			(@diagramname IS NULL OR name = @diagramname) AND
			(@owner_id IS NULL OR principal_id = @owner_id)
		ORDER BY
			4, 5, 1
	END
	
GO

-- ----------------------------
-- Procedure structure for sp_renamediagram
-- ----------------------------
DROP PROCEDURE [sp_renamediagram]
GO

	CREATE PROCEDURE [sp_renamediagram]
	(
		@diagramname 		sysname,
		@owner_id		int	= null,
		@new_diagramname	sysname
	
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
		declare @theId 			int
		declare @IsDbo 			int
		
		declare @UIDFound 		int
		declare @DiagId			int
		declare @DiagIdTarg		int
		declare @u_name			sysname
		if((@diagramname is null) or (@new_diagramname is null))
		begin
			RAISERROR ('Invalid value', 16, 1);
			return -1
		end
	
		EXECUTE AS CALLER;
		select @theId = DATABASE_PRINCIPAL_ID();
		select @IsDbo = IS_MEMBER(N'db_owner'); 
		if(@owner_id is null)
			select @owner_id = @theId;
		REVERT;
	
		select @u_name = USER_NAME(@owner_id)
	
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname 
		if(@DiagId IS NULL or (@IsDbo = 0 and @UIDFound <> @theId))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1)
			return -3
		end
	
		-- if((@u_name is not null) and (@new_diagramname = @diagramname))	-- nothing will change
		--	return 0;
	
		if(@u_name is null)
			select @DiagIdTarg = diagram_id from dbo.sysdiagrams where principal_id = @theId and name = @new_diagramname
		else
			select @DiagIdTarg = diagram_id from dbo.sysdiagrams where principal_id = @owner_id and name = @new_diagramname
	
		if((@DiagIdTarg is not null) and  @DiagId <> @DiagIdTarg)
		begin
			RAISERROR ('The name is already used.', 16, 1);
			return -2
		end		
	
		if(@u_name is null)
			update dbo.sysdiagrams set [name] = @new_diagramname, principal_id = @theId where diagram_id = @DiagId
		else
			update dbo.sysdiagrams set [name] = @new_diagramname where diagram_id = @DiagId
		return 0
	END
	
GO

-- ----------------------------
-- Procedure structure for sp_upgraddiagrams
-- ----------------------------
DROP PROCEDURE [sp_upgraddiagrams]
GO

	CREATE PROCEDURE [sp_upgraddiagrams]
	AS
	BEGIN
		IF OBJECT_ID(N'dbo.sysdiagrams') IS NOT NULL
			return 0;
	
		CREATE TABLE dbo.sysdiagrams
		(
			name sysname NOT NULL,
			principal_id int NOT NULL,	-- we may change it to varbinary(85)
			diagram_id int PRIMARY KEY IDENTITY,
			version int,
	
			definition varbinary(max)
			CONSTRAINT UK_principal_name UNIQUE
			(
				principal_id,
				name
			)
		);


		/* Add this if we need to have some form of extended properties for diagrams */
		/*
		IF OBJECT_ID(N'dbo.sysdiagram_properties') IS NULL
		BEGIN
			CREATE TABLE dbo.sysdiagram_properties
			(
				diagram_id int,
				name sysname,
				value varbinary(max) NOT NULL
			)
		END
		*/

		IF OBJECT_ID(N'dbo.dtproperties') IS NOT NULL
		begin
			insert into dbo.sysdiagrams
			(
				[name],
				[principal_id],
				[version],
				[definition]
			)
			select	 
				convert(sysname, dgnm.[uvalue]),
				DATABASE_PRINCIPAL_ID(N'dbo'),			-- will change to the sid of sa
				0,							-- zero for old format, dgdef.[version],
				dgdef.[lvalue]
			from dbo.[dtproperties] dgnm
				inner join dbo.[dtproperties] dggd on dggd.[property] = 'DtgSchemaGUID' and dggd.[objectid] = dgnm.[objectid]	
				inner join dbo.[dtproperties] dgdef on dgdef.[property] = 'DtgSchemaDATA' and dgdef.[objectid] = dgnm.[objectid]
				
			where dgnm.[property] = 'DtgSchemaNAME' and dggd.[uvalue] like N'_EA3E6268-D998-11CE-9454-00AA00A3F36E_' 
			return 2;
		end
		return 1;
	END
	
GO

-- ----------------------------
-- Function structure for fn_diagramobjects
-- ----------------------------
DROP FUNCTION [fn_diagramobjects]
GO

	CREATE FUNCTION [fn_diagramobjects]() 
	RETURNS int
	WITH EXECUTE AS N'dbo'
	AS
	BEGIN
		declare @id_upgraddiagrams		int
		declare @id_sysdiagrams			int
		declare @id_helpdiagrams		int
		declare @id_helpdiagramdefinition	int
		declare @id_creatediagram	int
		declare @id_renamediagram	int
		declare @id_alterdiagram 	int 
		declare @id_dropdiagram		int
		declare @InstalledObjects	int

		select @InstalledObjects = 0

		select 	@id_upgraddiagrams = object_id(N'dbo.sp_upgraddiagrams'),
			@id_sysdiagrams = object_id(N'dbo.sysdiagrams'),
			@id_helpdiagrams = object_id(N'dbo.sp_helpdiagrams'),
			@id_helpdiagramdefinition = object_id(N'dbo.sp_helpdiagramdefinition'),
			@id_creatediagram = object_id(N'dbo.sp_creatediagram'),
			@id_renamediagram = object_id(N'dbo.sp_renamediagram'),
			@id_alterdiagram = object_id(N'dbo.sp_alterdiagram'), 
			@id_dropdiagram = object_id(N'dbo.sp_dropdiagram')

		if @id_upgraddiagrams is not null
			select @InstalledObjects = @InstalledObjects + 1
		if @id_sysdiagrams is not null
			select @InstalledObjects = @InstalledObjects + 2
		if @id_helpdiagrams is not null
			select @InstalledObjects = @InstalledObjects + 4
		if @id_helpdiagramdefinition is not null
			select @InstalledObjects = @InstalledObjects + 8
		if @id_creatediagram is not null
			select @InstalledObjects = @InstalledObjects + 16
		if @id_renamediagram is not null
			select @InstalledObjects = @InstalledObjects + 32
		if @id_alterdiagram  is not null
			select @InstalledObjects = @InstalledObjects + 64
		if @id_dropdiagram is not null
			select @InstalledObjects = @InstalledObjects + 128
		
		return @InstalledObjects 
	END
	
GO

-- ----------------------------
-- Indexes structure for table jawaban_responden
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table jawaban_responden
-- ----------------------------
ALTER TABLE [jawaban_responden] ADD PRIMARY KEY ([id_jawaban_responden])
GO

-- ----------------------------
-- Indexes structure for table jenis_pertanyaan
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table jenis_pertanyaan
-- ----------------------------
ALTER TABLE [jenis_pertanyaan] ADD PRIMARY KEY ([id_jenis_pertanyaan])
GO

-- ----------------------------
-- Indexes structure for table kuesioner
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table kuesioner
-- ----------------------------
ALTER TABLE [kuesioner] ADD PRIMARY KEY ([id_kuesioner])
GO

-- ----------------------------
-- Indexes structure for table pertanyaan
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table pertanyaan
-- ----------------------------
ALTER TABLE [pertanyaan] ADD PRIMARY KEY ([id_pertanyaan])
GO

-- ----------------------------
-- Indexes structure for table pilihan_ganda
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table pilihan_ganda
-- ----------------------------
ALTER TABLE [pilihan_ganda] ADD PRIMARY KEY ([id_pilihan_ganda])
GO

-- ----------------------------
-- Indexes structure for table responden
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table responden
-- ----------------------------
ALTER TABLE [responden] ADD PRIMARY KEY ([id_responden])
GO

-- ----------------------------
-- Indexes structure for table responden_kuesioner
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table responden_kuesioner
-- ----------------------------
ALTER TABLE [responden_kuesioner] ADD PRIMARY KEY ([id_responden_kuesioner])
GO

-- ----------------------------
-- Indexes structure for table skala
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table skala
-- ----------------------------
ALTER TABLE [skala] ADD PRIMARY KEY ([id_skala])
GO

-- ----------------------------
-- Indexes structure for table sysdiagrams
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table sysdiagrams
-- ----------------------------
ALTER TABLE [sysdiagrams] ADD PRIMARY KEY ([diagram_id])
GO

-- ----------------------------
-- Uniques structure for table sysdiagrams
-- ----------------------------
ALTER TABLE [sysdiagrams] ADD UNIQUE ([principal_id] ASC, [name] ASC)
GO

-- ----------------------------
-- Indexes structure for table tabel_t
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table tabel_t
-- ----------------------------
ALTER TABLE [tabel_t] ADD PRIMARY KEY ([id_tabel_t])
GO

-- ----------------------------
-- Indexes structure for table user
-- ----------------------------

-- ----------------------------
-- Primary Key structure for table user
-- ----------------------------
ALTER TABLE [user] ADD PRIMARY KEY ([id_user])
GO

-- ----------------------------
-- Foreign Key structure for table [kuesioner]
-- ----------------------------
ALTER TABLE [kuesioner] ADD FOREIGN KEY ([fk_id_user]) REFERENCES [user] ([id_user]) ON DELETE NO ACTION ON UPDATE NO ACTION
GO

-- ----------------------------
-- Foreign Key structure for table [pertanyaan]
-- ----------------------------
ALTER TABLE [pertanyaan] ADD FOREIGN KEY ([fk_id_jenis_pertanyaan]) REFERENCES [jenis_pertanyaan] ([id_jenis_pertanyaan]) ON DELETE NO ACTION ON UPDATE NO ACTION
GO
ALTER TABLE [pertanyaan] ADD FOREIGN KEY ([fk_id_kuesioner]) REFERENCES [kuesioner] ([id_kuesioner]) ON DELETE NO ACTION ON UPDATE NO ACTION
GO
ALTER TABLE [pertanyaan] ADD FOREIGN KEY ([fk_id_skala]) REFERENCES [skala] ([id_skala]) ON DELETE NO ACTION ON UPDATE NO ACTION
GO

-- ----------------------------
-- Foreign Key structure for table [responden_kuesioner]
-- ----------------------------
ALTER TABLE [responden_kuesioner] ADD FOREIGN KEY ([fk_id_jawaban_responden]) REFERENCES [jawaban_responden] ([id_jawaban_responden]) ON DELETE CASCADE ON UPDATE CASCADE
GO
ALTER TABLE [responden_kuesioner] ADD FOREIGN KEY ([fk_id_pertanyaan]) REFERENCES [pertanyaan] ([id_pertanyaan]) ON DELETE NO ACTION ON UPDATE NO ACTION
GO
ALTER TABLE [responden_kuesioner] ADD FOREIGN KEY ([fk_id_responden]) REFERENCES [responden] ([id_responden]) ON DELETE CASCADE ON UPDATE CASCADE
GO
